#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <QTimer>

namespace Ui {
class Widget;
}

class Widget : public QWidget
{
    Q_OBJECT

public:
    explicit Widget(QWidget *parent = 0);
    ~Widget();


private slots:
    void on_but_open_clicked(bool checked);

    void on_but_up_pressed();

    void on_but_left_pressed();

    void on_but_down_pressed();

    void on_but_right_pressed();

    void on_but_reset_clicked();

    void on_but_up_released();

    void on_but_left_released();

    void on_but_right_released();

    void on_but_reset_released();

    void on_but_down_released();

    void on_Slider_hand_valueChanged(int value);

    void on_but_after_pressed();

    void on_but_front_pressed();

    void on_but_front_released();

    void on_but_after_released();

    void on_dial_rotate_valueChanged(int value);

    void change();

    void setText();
    void on_but_sned_clicked();

private:
    bool sendMessage(int data,int id);
    void delay(int msec);
private:
    Ui::Widget *ui;
    QSerialPort* port=nullptr;
    QList<QSerialPortInfo> pool_port;

    int m4_theta=0;
    int m5_theta=0;
    int m6_theta=0;
    int m7_theta=0;
    int m8_theta=0;
    int m9_theta=0;

    bool is_left=false;
    bool is_right=false;
    bool is_up=false;
    bool is_down=false;
    bool is_front=false;
    bool is_after=false;


    bool is_reset=false;

    bool is_open=false;

    QTimer *timer=nullptr;
};

#endif // WIDGET_H
